package com.cdxy.controller;


import com.cdxy.biz.process.ISceneBizProcess;
import com.cdxy.model.dto.base.controller.BaseController;
import com.cdxy.model.dto.base.resp.ApiResponse;
import com.cdxy.model.dto.base.resp.BasePageResp;
import com.cdxy.model.dto.req.SceneDetailReq;
import com.cdxy.model.dto.req.SearchSceneReq;
import com.cdxy.model.dto.resp.SceneDetailResp;
import com.cdxy.model.dto.resp.SearchSceneResp;
import com.cdxy.util.AxUidUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 景点表 前端控制器
 * </p>
 *
 * @author autoGenCode
 * @since 2020-03-05
 */
@RestController
@RequestMapping("/scene")
@Api(tags = "景点")
public class SceneController extends BaseController {

    @Autowired
    private ISceneBizProcess sceneBizProcess;

    @Autowired
    private AxUidUtil axUidUtil;

    @GetMapping("/searchScene")
    @ApiOperation(value = "景点搜索后", notes = "")
    public ApiResponse<BasePageResp<SearchSceneResp>> searchScene(@Validated SearchSceneReq searchSceneReq) {
        searchSceneReq.setAxUid(axUidUtil.getAxUidNotForce());
        return successApiResponse(sceneBizProcess.searchScene(searchSceneReq));
    }

    @GetMapping("/sceneDetail")
    @ApiOperation(value = "景点详情", notes = "")
    public ApiResponse<SceneDetailResp> sceneDetail(@Validated SceneDetailReq sceneDetailReq) {
        sceneDetailReq.setAxUid(axUidUtil.getAxUidNotForce());
        return successApiResponse(sceneBizProcess.sceneDetail(sceneDetailReq));
    }
}
